//
//  ContentCollectionViewCell.m
//  W2MD
//
//  Created by zhudongwei on 14-9-17.
//  Copyright (c) 2014年 zhudongwei. All rights reserved.
//

#import "ContentCollectionViewCell.h"

@implementation ContentCollectionViewCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self != nil)
    {
        // create our image view so that is matches the height and width of this cell
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
        self.imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        self.imageView.contentMode = UIViewContentModeScaleAspectFill;
        self.imageView.clipsToBounds = YES;
        
        // add a white frame around the image
        //self.imageView.layer.borderWidth = 1.0;
        
        self.imageView.layer.masksToBounds = YES; //没这句话它圆不起来
        self.imageView.layer.cornerRadius = 3.0; //设置图片圆角的尺度
        
//        self.layer.shadowColor = [UIColor blackColor].CGColor;//shadowColor阴影颜色
//        self.layer.shadowOffset = CGSizeMake(2,2);//shadowOffset阴影偏移,x向右偏移4，y向下偏移4，默认(0, -3),这个跟shadowRadius配合使用
//        self.layer.shadowOpacity = 0.4;//阴影透明度，默认0
//        self.layer.shadowRadius = 2;//阴影半径，默认3
        
        self.imageView.layer.borderColor = [UIColor whiteColor].CGColor;
        
        // Define how the edges of the layer are rasterized for each of the four edges
        // (left, right, bottom, top) if the corresponding bit is set the edge will be antialiased
        //
        self.imageView.layer.edgeAntialiasingMask =
        kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge;
        
        
        [[self contentView] addSubview:self.imageView];
        
        self.downloading=NO;
        
        self.label=[[UILabel alloc] initWithFrame:CGRectMake(0, self.frame.size.height/2, self.frame.size.width, 20)];
        self.label.textAlignment=NSTextAlignmentCenter;
        self.label.font=[UIFont boldSystemFontOfSize:18];
        self.label.textColor=[UIColor blackColor];
        //[self.contentView addSubview:self.label];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/
- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        
    }
    return self;
}

@end
